package dubbo.server2.impl.elasticjob;

import dubbo.server2.impl.controller.EasyTaskController;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
import com.dangdang.ddframe.job.api.ShardingContext;

@Component
public class MySimpleJob implements com.dangdang.ddframe.job.api.simple.SimpleJob {
    private Logger logger = Logger.getLogger(MySimpleJob.class);
    @Override
    public void execute(ShardingContext shardingContext) {
        logger.info(String.format("------Thread ID: %s, 任务总片数: %s, " +
                        "当前分片项: %s.当前参数: %s," +
                        "当前任务名称: %s.当前任务参数: %s"
                ,
                Thread.currentThread().getId(),
                shardingContext.getShardingTotalCount(),
                shardingContext.getShardingItem(),
                shardingContext.getShardingParameter(),
                shardingContext.getJobName(),
                shardingContext.getJobParameter()

        ));

    }
}
